﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="RegistrarRequerimientos.aspx.cs" Inherits="AppGestionRequerimientos.RegistrarRequerimientos" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <!-- Use the .htaccess and remove these lines to avoid edge case issues.
	       More info: h5bp.com/b/378 -->
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="description" content="Sistema ASR" />
        <meta name="author" content="Anovo Peru" />
        <!-- Mobile viewport optimized: h5bp.com/viewport -->
        <meta name="viewport" content="width=device-width,initial-scale=1" />
        <!-- iPhone: Don't render numbers as call links -->
        <meta name="format-detection" content="telephone=no" />
        <link rel="shortcut icon" href="favicon.ico" />
        <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
        <!-- The Styles -->
        <!-- ---------- -->
        <!-- Layout Styles -->
        <link rel="stylesheet" href="css/style.css" />
        <link rel="stylesheet" href="css/grid.css" />
        <link rel="stylesheet" href="css/layout.css" />
        <!-- Icon Styles -->
        <link rel="stylesheet" href="css/icons.css" />
        <link rel="stylesheet" href="css/fonts/font-awesome.css" />
        <!--[if IE 8]><link rel="stylesheet" href="css/fonts/font-awesome-ie7.css"><![endif]-->
        <!-- External Styles -->
        <link rel="stylesheet" href="css/external/jquery-ui-1.8.21.custom.css" />
        <link rel="stylesheet" href="css/external/jquery.chosen.css" />
        <link rel="stylesheet" href="css/external/jquery.cleditor.css" />
        <link rel="stylesheet" href="css/external/jquery.colorpicker.css" />
        <link rel="stylesheet" href="css/external/jquery.elfinder.css" />
        <link rel="stylesheet" href="css/external/jquery.fancybox.css" />
        <link rel="stylesheet" href="css/external/jquery.jgrowl.css" />
        <link rel="stylesheet" href="css/external/jquery.plupload.queue.css" />
        <link rel="stylesheet" href="css/external/syntaxhighlighter/shCore.css" />
        <link rel="stylesheet" href="css/external/syntaxhighlighter/shThemeDefault.css" />
        <!-- Elements -->
        <link rel="stylesheet" href="css/elements.css" />
        <link rel="stylesheet" href="css/forms.css" />
        <!-- OPTIONAL: Print Stylesheet for Invoice -->
        <link rel="stylesheet" href="css/print-invoice.css" />
        <!-- Typographics -->
        <link rel="stylesheet" href="css/typographics.css" />
        <!-- Responsive Design -->
        <link rel="stylesheet" href="css/media-queries.css" />
        <!-- Bad IE Styles -->
        <link rel="stylesheet" href="css/ie-fixes.css" />
        <!-- The Scripts -->
        <!-- ----------- -->
        <!-- JavaScript at the top (will be cached by browser) -->
        <script type="text/javascript" src="js/webfont.js"></script>
        <!-- Essential polyfills -->
        <script type="text/javascript" src="js/mylibs/polyfills/modernizr-2.6.1.min.js"></script>
        <script type="text/javascript" src="js/mylibs/polyfills/respond.js"></script>
        <script type="text/javascript" src="js/mylibs/polyfills/matchmedia.js"></script>
        <!--[if lt IE 9]><script src="js/mylibs/polyfills/selectivizr-min.js"></script><![endif]-->
        <!--[if lt IE 10]><script src="js/mylibs/charts/excanvas.js"></script><![endif]-->
        <!--[if lt IE 10]><script src="js/mylibs/polyfills/classlist.js"></script><![endif]-->
        <!-- Grab frameworks from CDNs -->
        <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script type="text/javascript">            window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.min.js"><\/script>')</script>
        <!-- Do the same with jQuery UI -->
        <script type="text/javascript" src="js/jquery-ui.min.js"></script>
        <script type="text/javascript">            window.jQuery.ui || document.write('<script src="js/libs/jquery-ui-1.8.21.min.js"><\/script>')</script>
        <!-- Do the same with Lo-Dash.js -->
        <script type="text/javascript" src="js/lodash.min.js"></script>
        <script type="text/javascript">            window._ || document.write('<script src="js/libs/lodash.min.js"><\/script>')</script>
        <!-- scripts concatenated and minified via build script -->
        <!-- General Scripts -->
        <script type="text/javascript" src="js/mylibs/jquery.hashchange.js"></script>
        <script type="text/javascript" src="js/mylibs/jquery.idle-timer.js"></script>
        <script type="text/javascript" src="js/mylibs/jquery.plusplus.js"></script>
        <script type="text/javascript" src="js/mylibs/jquery.jgrowl.js"></script>
        <script type="text/javascript" src="js/mylibs/jquery.scrollTo.js"></script>
        <script type="text/javascript" src="js/mylibs/jquery.ui.touch-punch.js"></script>
        <script type="text/javascript" src="js/mylibs/jquery.ui.multiaccordion.js"></script>
        <script type="text/javascript" src="js/mylibs/number-functions.js"></script>
        <!-- Forms -->
        <script type="text/javascript" src="js/mylibs/forms/jquery.autosize.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.checkbox.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.chosen.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.cleditor.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.colorpicker.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.ellipsis.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.fileinput.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.fullcalendar.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.maskedinput.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.mousewheel.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.placeholder.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.pwdmeter.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.ui.datetimepicker.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.ui.spinner.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/jquery.validate.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/uploader/plupload.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/uploader/plupload.html5.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/uploader/plupload.html4.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/uploader/plupload.flash.js"></script>
        <script type="text/javascript" src="js/mylibs/forms/uploader/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <!-- Charts -->
        <script type="text/javascript" src="js/mylibs/charts/jquery.flot.js"></script>
        <script type="text/javascript" src="js/mylibs/charts/jquery.flot.orderBars.js"></script>
        <script type="text/javascript" src="js/mylibs/charts/jquery.flot.pie.js"></script>
        <script type="text/javascript" src="js/mylibs/charts/jquery.flot.resize.js"></script>
        <!-- Explorer -->
        <script type="text/javascript" src="js/mylibs/explorer/jquery.elfinder.js"></script>
        <!-- Fullstats -->
        <script type="text/javascript" src="js/mylibs/fullstats/jquery.css-transform.js"></script>
        <script type="text/javascript" src="js/mylibs/fullstats/jquery.animate-css-rotate-scale.js"></script>
        <script type="text/javascript" src="js/mylibs/fullstats/jquery.sparkline.js"></script>
        <!-- Syntax Highlighter -->
        <script type="text/javascript" src="js/mylibs/syntaxhighlighter/shCore.js"></script>
        <script type="text/javascript" src="js/mylibs/syntaxhighlighter/shAutoloader.js"></script>
        <!-- Dynamic Tables -->
        <script type="text/javascript" src="js/mylibs/dynamic-tables/jquery.dataTables.js"></script>
        <script type="text/javascript" src="js/mylibs/dynamic-tables/jquery.dataTables.tableTools.zeroClipboard.js"></script>
        <script type="text/javascript" src="js/mylibs/dynamic-tables/jquery.dataTables.tableTools.js"></script>
        <!-- Gallery -->
        <script type="text/javascript" src="js/mylibs/gallery/jquery.fancybox.js"></script>
        <!-- Tooltips -->
        <script type="text/javascript" src="js/mylibs/tooltips/jquery.tipsy.js"></script>
        <!-- Do not touch! -->
        <script type="text/javascript" src="js/mango.js"></script>
        <script type="text/javascript" src="js/plugins.js"></script>
        <script type="text/javascript" src="js/script.js"></script>
        <!-- Your custom JS goes here -->
        <script type="text/javascript" src="js/app.js"></script>
    <!-- end scripts -->
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="grid_12">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <form action="RegistrarRequerimientos.aspx" class="box validate" method="post">
        <div class="header">
            <div class="row">
                <h1 class="grid_12">Registro de Requerimientos</h1>
            </div>
        </div>
        <% if (hrRespuesta.Value == "0") {%>
        <div class="alert error">
            <span class="icon"></span><strong>Error!</strong> Ha ocurrido un error al grabar.
        </div>
        <%}
           else if (hrRespuesta.Value == "1")
           {%>
        <div class="alert success">
            <span class="icon"></span><strong>Correcto!</strong> Se ha registrado el requerimiento correctamente.
        </div>
        <%} %>         
        <div class="header">
            <div class="row">
                <h2>Datos del Requerimiento</h2>
            </div>
        </div>
        <div class="content">           
            <div class="row">                 
                <p class="_25">
                    <label>Nro Requerimiento:</label>                   
                </p>
                <p class="_25">                   
                    <asp:TextBox ID="txtNroReq" runat="server" Enabled="false" ReadOnly="true"></asp:TextBox>
                </p>  
                <p class="_25">
                    <label> </label>                    
                </p>
                <p class="_25">
                    <label> </label>                    
                </p>
            </div>
            <div class="row">                 
                <p class="_25">
                    <label>Fecha Requerimiento:</label>                    
                </p>
                <p class="_25">                    
                    <asp:Label ID="lblFechaReq" runat="server"></asp:Label>
                </p>           
                <p class="_25">
                    <label>Hora:</label>
                </p>
                <p class="_25">   
                    <asp:Label ID="lblHoraReq" runat="server" Enabled="false" ReadOnly="true"></asp:Label>
                </p>
            </div>
            <div class="row">                 
                <p class="_25">
                    <label>Observaciones:</label>
                </p>
                <p class="_75">   
                    <asp:TextBox ID="txtObservaciones" runat="server"></asp:TextBox>
                </p>                
            </div>                        
            <asp:HiddenField ID="hrRespuesta" runat="server" />
            <div class="header">
                <div class="row">
                    <h2>Materiales a solicitar en el requerimiento</h2>
                </div>
            </div>
            <div class="row">
                <p class="_25">
                    <label>Categoria:</label>
                </p>
                <p class="_75">   
                    <asp:DropDownList ID="cboCategoria" runat="server" CssClass="search" data-placeholder="---Seleccione Categoria---"
                        AppendDataBoundItems="true" DataTextField="vNomCat" DataValueField="iCodCat"
                        Enabled="true" AutoPostBack="true" Width="70%" onselectedindexchanged="cboCategoria_SelectedIndexChanged">
                    </asp:DropDownList>
                </p>
                <p class="_25">
                    <label>Subcategoria:</label>
                </p>
                <p class="_75">   
                    <asp:DropDownList ID="cboSubCategoria" runat="server" CssClass="search" data-placeholder="---Seleccione Subcategoria---"
                        AppendDataBoundItems="true" DataTextField="vNomSub" DataValueField="iCodSub"
                        Enabled="true" AutoPostBack="true" Width="70%" onselectedindexchanged="cboSubCategoria_SelectedIndexChanged">
                    </asp:DropDownList>
                </p>
                <p class="_25">
                    <label>Materiales:</label>
                </p>
                <p class="_75">   
                    <asp:DropDownList ID="cboMaterial" runat="server" CssClass="search" data-placeholder="---Seleccione Material---"
                        AppendDataBoundItems="true" DataTextField="vNomMat" DataValueField="iCodMat"
                        Enabled="true" AutoPostBack="true" Width="70%"  OnSelectedIndexChanged="cboMaterial_SelectedIndexChanged">
                    </asp:DropDownList><asp:HiddenField ID="nomMaterial" runat="server"/>
                </p>
                <p class="_25">
                    <label>Stock:</label>
                </p>
                <p class="_75">   
                    <asp:Label ID="lblStock" runat="server"></asp:Label>
                </p>            
            </div>
            <div class="row">                
                <asp:UpdatePanel ID="UpdatePanel7" runat="server" UpdateMode="Conditional" RenderMode="Inline">
                    <ContentTemplate>
                        <p class="_25">
                            <label>Cantidad:</label>
                        </p>
                        <p class="_25">   
                            <asp:TextBox ID="txtCantidad" runat="server"></asp:TextBox>
                        </p>
                        <p class="_25">
                            <asp:Label ID="lblUniMedidaCant" runat="server" Enabled="false" ReadOnly="true"></asp:Label>
                        </p>
                        <p class="_25">
                            <asp:Button 
                                ID="btnAgregarR" runat="server" Text="Agregar" OnClick="btnAgregarR_Click" CssClass="buttons" />
                            <asp:Button ID="btnLimpiarR" runat="server" Text="Limpiar" OnClick="btnLimpiarR_Click" CssClass="buttons" />
                        </p>                   
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnAgregarR" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="btnLimpiarR" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>                             
            </div>
            <div class="content">
                <div class="row">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" RenderMode="Inline">
                        <ContentTemplate>
                            <center>
                                <asp:GridView 
                                    ID="listarMateriales" runat="server" AutoGenerateColumns="False" EmptyDataText="No ingreso ningún material"
                                    ShowHeaderWhenEmpty="True" BackColor="White" BorderColor="#999999" BorderStyle="Solid"
                                    BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical" OnRowDeleting="listarMaterial_RowDeleting">
                                    <AlternatingRowStyle BackColor="#CCCCCC" />
                                    <FooterStyle BackColor="#CCCCCC" />
                                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                                    <SortedAscendingHeaderStyle BackColor="#808080" />
                                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                                    <SortedDescendingHeaderStyle BackColor="#383838" />
                                    <Columns>
                                        <asp:BoundField DataField="item" HeaderText="Item" />
                                        <asp:BoundField DataField="codigo" HeaderText="Codigo" />
                                        <asp:BoundField DataField="descripcion" HeaderText="Descripcion" />
                                        <asp:BoundField DataField="uniMedida" HeaderText="Unid. Medida" />
                                        <asp:BoundField DataField="cantidad" HeaderText="Cantidad" />                                       
                                        <asp:CommandField ShowDeleteButton="True" ButtonType="Image" 
                                            DeleteImageUrl="~/img/delete.png" />
                                    </Columns>
                                    <EmptyDataTemplate>
                                        <label>*Lista de Materiales vacia</label>
                                    </EmptyDataTemplate>
                                </asp:GridView>                                
                            </center>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnAgregarR" EventName="Click" />
                            <asp:AsyncPostBackTrigger ControlID="btnLimpiarR" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
                </div>
            </div>
            <div class="row">
                <p class="_25">
                    <label>&nbsp;</label>
                </p>
                <p class="_25">                    
                    <asp:Button ID="btnGuardar" runat="server" Text="Guardar" OnClick="btnGuardar_Click"/>                    
                </p>
                <p class="_25">                                            
                    <asp:Button ID="btnCancelar" runat="server" Text="Cancelar" onclick="btnCancelar_Click"/>
                </p>
                <p class="_25">
                    <label>&nbsp;</label>
                </p>
        </div>

        </div>
        </form>
    </div>
</asp:Content>
